<div class="row">
  <div class="col-lg-12">
    <div class="panel panel-primary">
      <div class="panel-body" ng-init="send('acl.index', {})">
        <div class="row">
          <div class="col-lg-10 pull-right">
            <div ui-view></div>
          </div>
        </div>

        <div class="row content">
          <div class="col-lg-3 well" ng-repeat="e in acl_index" style="margin: 0.5em;">
            <div ng-switch on="e.editing" ng-init="e.editing = false;">
              <div ng-switch-when="false">
                <h4><i class="fa fa-fire fa-2x prefix text-danger"></i>{{e.app.name}}
                  <small><b>【{{e.appid}}】</b></small>
                  <small><a href ng-click="e.editing = true;">
                      <i class="fa fa-edit fa-1x text-info pull-right"></i>
                  </a></small>
                </h4>
                <hr>

                <p>
                  <b>默认操作授权</b><br><span style="padding-left: 1em;">{{e.default}}</span>
                </p>

                <b>授权操作人员名单</b>
                <ul>
                  <li ng-repeat="p in e.allow">{{p}}</li>
                </ul>

                <b>禁止操作人员名单</b>
                <ul>
                  <li ng-repeat="p in e.deny">{{p}}</li>
                </ul>
              </div>

              <div ng-switch-default>
                <h4><i class="fa fa-fire fa-2x prefix text-danger"></i>{{e.app.name}}
                  <small><b>【{{e.appid}}】</b></small>
                </h4>
                <hr>

                <form name="createForm" role="form" ng-submit="send('acl.edit', e)">
                  <div class="form-group">
                    <label class="control-label required">默认操作授权</label>
                    <select class="form-control" ng-model="e.default" ng-options="r for r in acl_options" required></select>
                  </div>

                  <div class="form-group">
                    <label class="control-label">授权操作人员名单</label>
                    <div class="row">
                      <div class="col-lg-8">
                        <input type="text" class="form-control" placeholder="人员的登录账号，例：zhangsan" ng-model="allow_new">
                      </div>
                      <div class="col-lg-4">
                        <p class="form-control-static" ng-show="allow_new.length > 0">
                          <a href ng-click="e.allow.push(allow_new); allow_new = '';">
                            <i class="fa fa-check fa-1x"></i>
                          </a>
                        </p>
                      </div>
                    </div>
                  </div>
                  <div class="form-group">
                    <ul><li ng-repeat="t in e.allow">
                        <span>{{t}}</span>
                        <span>
                          <a href ng-click="e.allow = remove_item(e.allow, t);">
                            <i class="fa fa-remove fa-1x text-warning"></i>
                          </a>
                        </span>
                    </li></ul>
                  </div>

                  <div class="form-group">
                    <label class="control-label">禁止操作人员名单</label>
                    <div class="row">
                      <div class="col-lg-8">
                        <input type="text" class="form-control" placeholder="人员的登录账号，例：zhangsan" ng-model="deny_new">
                      </div>
                      <div class="col-lg-4">
                        <p class="form-control-static" ng-show="deny_new.length > 0">
                          <a href ng-click="e.deny.push(deny_new); deny_new = '';">
                            <i class="fa fa-check fa-1x"></i>
                          </a>
                        </p>
                      </div>
                    </div>
                  </div>
                  <div class="form-group">
                    <ul><li ng-repeat="t in e.deny">
                        <span>{{t}}</span>
                        <span>
                          <a href ng-click="e.deny = remove_item(e.deny, t);">
                            <i class="fa fa-remove fa-1x text-warning"></i>
                          </a>
                        </span>
                    </li></ul>
                  </div>

                  <div class="form-group">
                    <div class="col-sm-8">
                      <input class="btn btn-primary" type="submit" ng-disabled="createForm.$invalid"/>
                      或者
                      <a href ng-click="e.editing = false; send('acl.index', {});">取消</a>
                    </div>
                  </div>

                </form>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
